package com.agv.core.dao.dataExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.ResultSetExtractor;

import com.agv.core.objectDomain.DataModel;

public class DataModelRSExtractor implements ResultSetExtractor {

	@Override
	public Object extractData(ResultSet rs) throws SQLException,
			DataAccessException {
		DataModel dataModel = new DataModel();
		while (rs.next()) {
			dataModel.setNbParams(rs.getString("params").trim());
			dataModel.setNbQuery(rs.getString("query").trim());
			dataModel.setRptTitle(rs.getString("title").trim());
			dataModel.setNbHeaders(rs.getString("headers").trim());
		}
		return dataModel;
	}

}
